package com.ruoyi.neusoft.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.neusoft.domain.AiIdentifyCollectionImageT;
import com.ruoyi.neusoft.service.IAiIdentifyCollectionImageTService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * AI智能识别数据集的图像Controller
 * 
 * @author AI
 * @date 2023-12-06
 */
@Controller
@RequestMapping("/AI/ImageService")
public class AiIdentifyCollectionImageTController extends BaseController
{
    private String prefix = "AI/ImageService";

    @Autowired
    private IAiIdentifyCollectionImageTService aiIdentifyCollectionImageTService;

    @RequiresPermissions("AI:ImageService:view")
    @GetMapping()
    public String ImageService()
    {
        return prefix + "/ImageService";
    }

    /**
     * 查询AI智能识别数据集的图像列表
     */
    @RequiresPermissions("AI:ImageService:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(AiIdentifyCollectionImageT aiIdentifyCollectionImageT)
    {
        startPage();
        List<AiIdentifyCollectionImageT> list = aiIdentifyCollectionImageTService.selectAiIdentifyCollectionImageTList(aiIdentifyCollectionImageT);
        return getDataTable(list);
    }

    /**
     * 导出AI智能识别数据集的图像列表
     */
    @RequiresPermissions("AI:ImageService:export")
    @Log(title = "AI智能识别数据集的图像", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(AiIdentifyCollectionImageT aiIdentifyCollectionImageT)
    {
        List<AiIdentifyCollectionImageT> list = aiIdentifyCollectionImageTService.selectAiIdentifyCollectionImageTList(aiIdentifyCollectionImageT);
        ExcelUtil<AiIdentifyCollectionImageT> util = new ExcelUtil<AiIdentifyCollectionImageT>(AiIdentifyCollectionImageT.class);
        return util.exportExcel(list, "AI智能识别数据集的图像数据");
    }

    /**
     * 新增AI智能识别数据集的图像
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存AI智能识别数据集的图像
     */
    @RequiresPermissions("AI:ImageService:add")
    @Log(title = "AI智能识别数据集的图像", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(AiIdentifyCollectionImageT aiIdentifyCollectionImageT)
    {
        return toAjax(aiIdentifyCollectionImageTService.insertAiIdentifyCollectionImageT(aiIdentifyCollectionImageT));
    }

    /**
     * 修改AI智能识别数据集的图像
     */
    @RequiresPermissions("AI:ImageService:edit")
    @GetMapping("/edit/{imageId}")
    public String edit(@PathVariable("imageId") Long imageId, ModelMap mmap)
    {
        AiIdentifyCollectionImageT aiIdentifyCollectionImageT = aiIdentifyCollectionImageTService.selectAiIdentifyCollectionImageTByImageId(imageId);
        mmap.put("aiIdentifyCollectionImageT", aiIdentifyCollectionImageT);
        return prefix + "/edit";
    }

    /**
     * 修改保存AI智能识别数据集的图像
     */
    @RequiresPermissions("AI:ImageService:edit")
    @Log(title = "AI智能识别数据集的图像", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(AiIdentifyCollectionImageT aiIdentifyCollectionImageT)
    {
        return toAjax(aiIdentifyCollectionImageTService.updateAiIdentifyCollectionImageT(aiIdentifyCollectionImageT));
    }

    /**
     * 删除AI智能识别数据集的图像
     */
    @RequiresPermissions("AI:ImageService:remove")
    @Log(title = "AI智能识别数据集的图像", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(aiIdentifyCollectionImageTService.deleteAiIdentifyCollectionImageTByImageIds(ids));
    }
}
